package br.com.android.watcher;
import java.io.Serializable;
import java.util.Comparator;

public class Toon implements Comparator<Toon>, Serializable{

	private static final long serialVersionUID = 1L;
	private String name;
	private String realm;
	private String race;
	private String classe;
	private String level;
	
	private int score;
	private int lastscore;
	

	public String getLevel() {
		return level;
	}

	public void setLevel(String level) {
		this.level = level;
	}
	
	public Toon(String name, String realm){
		this.name = name;
		this.realm = realm;
		this.score = 0;
	}
	
	public Toon(String line){
		String[] data = line.split(":");
		name = data[0];
		realm = data[1];
		score = Integer.parseInt(data[2]);
	}
	
	public Toon() {
	}

	public int getScore(){
		return this.score;
	}
	public void setScore(int score){
		this.score = score;
	}
	public void updateScore(int score){
		this.lastscore = this.score;
		this.score = score;
	}
	public int getLastScore(){
		return this.lastscore;
	}
	public void setInfo(String classe, String race, String level){
		this.race = race;
		this.classe = classe;
		this.level = level;
	}
	public int compare(Toon obj1, Toon obj2){
				
	return obj2.score - obj1.score;
	}

	public boolean equals(Toon obj2){
		if((this.name.equalsIgnoreCase(obj2.name))&&(this.realm.equalsIgnoreCase(obj2.realm)))
			return true;
		else
			return false;
	}
	public String toString(){
		return "(" + score + ") " + name + " - " + race + " " + classe;
	}

	public String getRealm() {
		return this.realm;
	}

	public String getName() {
		return this.name;
	}
	public void setName(String name){
		this.name = name;
	}
	public String getRace() {
		return this.race;
	}
	public String getClasse(){
		return this.classe;
	}
	public String getSocialInfo(){
		return this.level + " " + this.race + " " + this.classe;
	}

}